Skip to content

chore: migrate monorepo from Yarn Classic to Yarn Berry#1321

Draft
mrgrain wants to merge 1 commit intomainfrom
mrgrain/chore/yarn-berry-migration
Draft

chore: migrate monorepo from Yarn Classic to Yarn Berry#1321
mrgrain wants to merge 1 commit intomainfrom
mrgrain/chore/yarn-berry-migration

Conversation

@mrgrain
Copy link
Copy Markdown
Contributor

@mrgrain mrgrain commented Apr 8, 2026

This migrates the monorepo from Yarn Classic (v1) to Yarn Berry (v4.13.0) by enabling the yarnBerry: true option in projenrc.

Yarn Classic has been in maintenance mode for years and Yarn Berry is the actively developed version. The migration is needed to stay on a supported package manager and to unblock future improvements that depend on Yarn Berry features, such as better workspace dependency resolution and the yarn dlx command.

The actual change is a single line in .projenrc.ts. Everything else is the result of running npx projen with the updated cdklabs-projen-project-types (^0.3.21) and projen (^0.99.38) which now support Yarn Berry monorepos.

The nodeLinker: node-modules setting in the new .yarnrc.yml files ensures that Yarn Berry continues to use the traditional node_modules layout. This means the migration should be transparent to all packages and their consumers — no code changes are required, only the tooling around dependency installation and workspace commands changes.

Notably, the Yarn Classic nohoist configuration in the root package.json is replaced by installConfig.hoistingLimits: workspaces in the packages that previously needed it (cloud-assembly-schema and cloud-assembly-api). This is the Yarn Berry equivalent and achieves the same isolation of bundled dependencies.

CI workflows are updated to use corepack enable before setup-node (so that the packageManager field in package.json is respected) and all yarn install flags are updated from the Classic syntax (--check-files, --frozen-lockfile) to the Berry equivalents (--no-immutable, --immutable). Task definitions in .projen/tasks.json switch from yarn workspaces run to yarn workspaces foreach --all --exclude . --topological-dev run and from npx to yarn dlx where appropriate.

Checklist

  • This change contains a major version upgrade for a dependency and I confirm all breaking changes are addressed
    • Release notes for the new version:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added the p2 label Apr 8, 2026
@aws-cdk-automation aws-cdk-automation requested a review from a team April 8, 2026 10:54
@mrgrain mrgrain marked this pull request as draft April 8, 2026 10:58
auto-merge was automatically disabled April 8, 2026 10:58

Pull request was converted to draft

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.29%. Comparing base (2a848bc) to head (8b2f363).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1321      +/-   ##
==========================================
+ Coverage   88.20%   88.29%   +0.08%     
==========================================
  Files          73       73              
  Lines       10386    10386              
  Branches     1409     1414       +5     
==========================================
+ Hits         9161     9170       +9     
+ Misses       1198     1189       -9     
  Partials       27       27              
Flag Coverage Δ
suite.unit 88.29% <ø> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mrgrain mrgrain force-pushed the mrgrain/chore/yarn-berry-migration branch from 01df504 to b548731 Compare April 8, 2026 12:54
@mrgrain mrgrain force-pushed the mrgrain/chore/yarn-berry-migration branch from b548731 to 3c92bb8 Compare April 8, 2026 12:59
Enable `yarnBerry: true` in projenrc and synthesize all packages.

Upgrades `cdklabs-projen-project-types` to ^0.3.21 and `projen` to
^0.99.38 which include Yarn Berry support for monorepos.
@mrgrain mrgrain force-pushed the mrgrain/chore/yarn-berry-migration branch from 52d20ce to 8b2f363 Compare April 8, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants